// litgroups.cpp
// Customizer_Pro
// Protea Customizer Pro / Business Logic for managing literal groups
// Copyright (C) 2003, 2004, 2005 eXegeSys, Inc.
// Copyright (C) 2008 Bruce A. James
//
// This program is part of the Protea Project.
//
// The Protea Project is free software; you can redistribute it and/or modify it 
// under the terms of the GNU General Public License as published by the 
// Free Software Foundation, either version 3 of the License, or (at your 
// option) any later version.
//
// The Protea Project is distributed in the hope that it will be useful, but 
// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 
// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 
// for more details.
// 
// You should have received a copy of the GNU General Public License along 
// with this program.  If not, see <http://www.gnu.org/licenses/>.
//
// Please send correspondence to:
//
// theproteaproject@gmail.com
//

#include "pro_customizer.h"

//////////////////////////////////////////////////////////////////////////////
//
// LIT_GROUP Transactions
//
//////////////////////////////////////////////////////////////////////////////

//@ CHA Add Literal Group Pro
//@ COD AddLiteralGroupPro
//@ NUM 28
//@ CRI LIT_GROUP_NAME
//@ TAB LIT_GROUP Write
//
//@ GEN Add Literal Group Pro will add a literal group for an application (pro)
//
TRANSACTION_CODE( AddLiteralGroupPro )
{
	//@ GRS Start the transaction
	START_TXN( AddLiteralGroupPro );
		START_DB_TXN();
			AddLiteralGroupInternal( &txnvars, true );
		END_DB_TXN();

		LOG_TRANSACTION();
	CLEANUP_TXN();
	END_TXN();
	//@ GRE End the transaction
};



//@ CHA Delete Literal Group Pro
//@ COD DeleteLiteralGroupPro
//@ NUM 29
//@ CRI LIT_GROUP_NAME
//@ TAB LIT_GROUP Write
//
//@ GEN Delete Literal Group Pro will delete a literal group for an application
//
TRANSACTION_CODE( DeleteLiteralGroupPro ) 
{
	//@ GRS Start the transaction
	START_TXN( DeleteLiteralGroup );
		START_DB_TXN();
			DelLiteralGroupInternal( &txnvars, true );
		END_DB_TXN();
		LOG_TRANSACTION();
	CLEANUP_TXN();
	END_TXN();
	//@ GRE End the transaction
};



//@ CHA Change Literal Group Pro
//@ COD ChangeLiteralGroupPro
//@ NUM 29
//@ CRI LIT_GROUP_NAME
//@ TAB LIT_GROUP Write
//
//@ GEN Change Literal Group Pro will alter a literal group for an application
//
TRANSACTION_CODE( ChangeLiteralGroupPro ) {
	//@ GRS Start the transaction
	bool require_log = false;

	START_TXN( ChangeLiteralGroupPro );
		START_DB_TXN();
			require_log = ChgLiteralGroupInternal( &txnvars, true );
		END_DB_TXN();

		if (require_log)
			LOG_TRANSACTION();
	CLEANUP_TXN();
	END_TXN();
	//@ GRE End the transaction
};
